package com.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.entity.CommentsEntity;
@Repository
public class CommentsDaoImpl extends GenericDaoImpl<CommentsEntity> implements CommentsDao{

	public CommentsEntity getCommentsById(Integer id) {
		return getById(CommentsEntity.class, id);
	}

	public List<CommentsEntity> getAllComments() {
		return getAll(CommentsEntity.class);
	}

	public CommentsEntity getCommentByUniqueId(String id) {
		String hql = "From CommentsEntity where id =:id";
		Query query = sessionFactory.getCurrentSession().createQuery(hql);
		query.setParameter("id",id);
		return (CommentsEntity) query.uniqueResult();
	}

}
